<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <div>直接使用{{num}}</div> 
    </div>
</body>
<script>
    new  Vue({
        // el:"#app",
        data:{
            num:10
        },
        template:'<div>获取数据{{num}}</div>',
        beforeCreate(){
            console.log(this.num);
        },
        created(){
            console.log(this.num);

            setTimeout(()=>{
                this.num =100;
            },5000)
            
        },
        beforeMount(){
            console.log("同步数据渲染页面之前")
        },
        mounted(){ //写页面的dom 操作   以及window的事件绑定
            console.log("同步数据渲染完成");
            setTimeout(()=>{
                this.num = 200;
            },2000)
        },
        beforeUpdate(){
            console.log("a")
        },
        updated(){
            console.log("b")
        },
        beforeDestroy(){
            console.log("c");
        },
        destroyed(){
            console.log("d")
        }    
    }).$mount("#app");

</script>
</html>

